package com.enmonster.dao;

import com.enmonster.annotations.*;
import com.enmonster.model.TestUser;

import java.util.List;

/**
 * @Author wuxi
 * @create 2019/4/8 下午6:36
 */
public interface TestUserDao {

    @WxSelect("select * from test_user where age=#{age} and user_name=#{userName} ")
    @WxResults({
            @WxResult(id=true,column="id",property="id"),
            @WxResult(column="user_name",property="userName"),
            @WxResult(column="age",property="age"),
    })
    List<TestUser> select(@WxParam("userName")String userName,@WxParam("age")Integer age);

    @WxSelect("select * from test_user")
    @WxResults({
            @WxResult(id=true,column="id",property="id"),
            @WxResult(column="user_name",property="userName"),
            @WxResult(column="age",property="age"),
    })
    List<TestUser> getAll();

    @WxSelect("select * from test_user where user_name=#{userName}")
    @WxResults({
            @WxResult(id=true,column="id",property="id"),
            @WxResult(column="user_name",property="userName"),
            @WxResult(column="age",property="age"),
    })
    TestUser getAccountByUserName(@WxParam("userName") String accountName);

    @WxInsert("insert into test_user (age,user_name) values (#{age},#{userName})")
    int insertData(TestUser account);
}
